<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">

	<ui:define name="body">

		<rich:panel>
			<f:facet name="header">Person Details</f:facet>


			<s:decorate id="boozAllenID" template="layout/display.xhtml">
				<ui:define name="label">Booz allen ID</ui:define>
				<h:outputText value="#{personHome.instance.boozAllenID}" />
			</s:decorate>

			<s:decorate id="cn" template="layout/display.xhtml">
				<ui:define name="label">Certificate CN</ui:define>
				<h:outputText value="#{personHome.instance.cn}" />
			</s:decorate>

			<s:decorate id="firstName" template="layout/display.xhtml">
				<ui:define name="label">First name</ui:define>
				<h:outputText value="#{personHome.instance.firstName}" />
			</s:decorate>

			<s:decorate id="lastName" template="layout/display.xhtml">
				<ui:define name="label">Last name</ui:define>
				<h:outputText value="#{personHome.instance.lastName}" />
			</s:decorate>

			<div style="clear:both" />

		</rich:panel>

		<div class="actionButtons">

			<s:button view="/PersonEdit.xhtml" id="edit"
				rendered="#{s:hasPermission('/PersonEdit.xhtml','render',null)}"
				value="Edit" />

			<s:button view="/#{empty personFrom ? 'PersonList' : personFrom}.xhtml"
				id="done" value="Done" />

		</div>

		<rich:tabPanel switchType="ajax">

			<rich:tab>
				<f:facet name="label">
					<h:panelGroup>
						<h:graphicImage value="/img/manytoone.gif"
							style="vertical-align: middle; padding-right: 4px;" />
						Manager
					</h:panelGroup>
				</f:facet>
				<div class="association" id="managerParent">

					<h:outputText value="There is no manager associated with this person."
						rendered="#{personHome.instance.manager == null}" />

					<rich:dataTable var="_person" value="#{personHome.instance.manager}"
						rendered="#{personHome.instance.manager != null}" rowClasses="rvgRowOne,rvgRowTwo"
						id="managerTable">
						<h:column>
							<f:facet name="header">Booz Allen ID</f:facet>
							<h:outputText value="#{_person.boozAllenID}" />
						</h:column>
						<h:column>
							<f:facet name="header">Certificate CN</f:facet>
							<h:outputText value="#{_person.cn}" />
						</h:column>
						<h:column>
							<f:facet name="header">First name</f:facet>
							<h:outputText value="#{_person.firstName}" />
						</h:column>
						<h:column>
							<f:facet name="header">Last name</f:facet>
							<h:outputText value="#{_person.lastName}" />
						</h:column>
						<h:column styleClass="action">
							<f:facet name="header">Action</f:facet>
							<s:link id="viewperson" value="View" view="/Person.xhtml">
								<f:param name="personId" value="#{_person.id}" />
							</s:link>
						</h:column>
					</rich:dataTable>

				</div>
			</rich:tab>

			<rich:tab rendered="#{not empty personHome.instance.directReports}">
				<f:facet name="label">
					<h:panelGroup>
						<h:graphicImage value="/img/onetomany.gif"
							style="vertical-align: middle; padding-right: 4px;" />
						Direct Reports
					</h:panelGroup>
				</f:facet>
				<div class="association" id="reports">

					<h:outputText
						value="There are no direct reports associated with this person"
						rendered="#{personHome.instance.directReports == null}" />

					<rich:dataTable var="_person"
						value="#{personHome.instance.directReports}" rendered="#{personHome.instance.directReports != null}"
						rowClasses="rvgRowOne,rvgRowTwo" id="drTable">
						<h:column>
							<f:facet name="header">Booz Allen ID</f:facet>
							<h:outputText value="#{_person.boozAllenID}" />
						</h:column>
						<h:column>
							<f:facet name="header">Certificate CN</f:facet>
							<h:outputText value="#{_person.cn}" />
						</h:column>
						<h:column>
							<f:facet name="header">First name</f:facet>
							<h:outputText value="#{_person.firstName}" />
						</h:column>
						<h:column>
							<f:facet name="header">Last name</f:facet>
							<h:outputText value="#{_person.lastName}" />
						</h:column>
						<h:column styleClass="action">
							<f:facet name="header">Action</f:facet>
							<s:link id="viewperson" value="View" view="/Person.xhtml">
								<f:param name="personId" value="#{_person.id}" />
							</s:link>
						</h:column>
					</rich:dataTable>

				</div>
			</rich:tab>




			<rich:tab rendered="#{not empty personHome.instance.projects}">
				<f:facet name="label">
					<h:panelGroup>
						<h:graphicImage value="/img/onetomany.gif"
							style="vertical-align: middle; padding-right: 4px;" />
						Projects
					</h:panelGroup>
				</f:facet>
				<div class="association" id="personProjects">

					<rich:dataTable id="projectList" var="_project"
						value="#{personHome.instance.projects}" rendered="#{not empty personHome.instance.projects}">
						<h:column>
							<f:facet name="header">ID</f:facet>
							<h:outputText value="#{_project.id}" />
						</h:column>
						<h:column>
							<f:facet name="header">Description</f:facet>
							<h:outputText value="#{_project.description}" />
						</h:column>
						<h:column>
							<f:facet name="header">Lable</f:facet>
							<h:outputText value="#{_project.label}" />
						</h:column>
						<rich:column styleClass="action">
							<f:facet name="header">Action</f:facet>
							<s:link view="/#{empty from ? 'Project' : from}.xhtml"
								value="#{empty from ? 'View' : 'Select'}" propagation="#{empty from ? 'none' : 'default'}"
								id="projectViewId">
								<f:param name="projectId" value="#{_project.id}" />
							</s:link>
							#{' '}
							<s:link view="/ProjectEdit.xhtml" value="Edit"
								propagation="none" id="projectEdit" rendered="#{empty from}">
								<f:param name="projectId" value="#{_project.id}" />
							</s:link>
						</rich:column>
					</rich:dataTable>

				</div>
			</rich:tab>


			<rich:tab>
				<f:facet name="label">
					<h:panelGroup>
						<h:graphicImage value="/img/onetomany.gif"
							style="vertical-align: middle; padding-right: 4px;" />
						Roles
					</h:panelGroup>
				</f:facet>
				<div class="association" id="personRoles">

					<rich:dataTable var="_role" value="#{personHome.instance.roles}"
						rendered="#{personHome.instance.roles != null}" rowClasses="rvgRowOne,rvgRowTwo"
						id="rolesTable">
						<h:column>
							<f:facet name="header">Role</f:facet>
							<h:outputText value="#{_role.name}" />
						</h:column>
					</rich:dataTable>

				</div>
			</rich:tab>
		</rich:tabPanel>
	</ui:define>
	<restrict/>

</ui:composition>
